//
//  ViewController.m
//  CustomsFont
//
//  Created by 王汉昌 on 15/12/31.
//  Copyright © 2015年 離去之原. All rights reserved.
//

#import "ViewController.h"
#import "FontListViewController.h"
#import "CustomFontViewController.h"
@interface ViewController ()
@property (nonatomic, strong) UIButton *customFontutton;
@property (nonatomic, strong) UIButton *fontListViewButton;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"首页";
    
    self.customFontutton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.customFontutton.bounds = CGRectMake(0, 0, 120, 50);
    self.customFontutton.center = CGPointMake(self.view.frame.size.width /2, self.view.frame.size.height/2 -50);
    [self.customFontutton setTitle:@"自定义Font" forState:UIControlStateNormal];
    self.customFontutton.backgroundColor = [UIColor cyanColor];
    [self.customFontutton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.customFontutton.layer.borderColor = [[UIColor redColor]CGColor];
    self.customFontutton.layer.borderWidth = 2;
    self.customFontutton.layer.cornerRadius = 5;
    [self.customFontutton addTarget:self action:@selector(customFontButtonClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.customFontutton];
    
    
    self.fontListViewButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.fontListViewButton.bounds = CGRectMake(0, 0, 120, 50);
    self.fontListViewButton.center = CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height/2 +50);
    self.fontListViewButton.layer.borderWidth = 2;
    self.fontListViewButton.layer.borderColor = [[UIColor redColor]CGColor];
    self.fontListViewButton.layer.cornerRadius = 5;
    [self.fontListViewButton setTitle:@"系统字体列表" forState:UIControlStateNormal];
    [self.fontListViewButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.fontListViewButton.backgroundColor = [UIColor cyanColor];
    [self.fontListViewButton addTarget:self action:@selector(fontListViewButtonClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.fontListViewButton];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)customFontButtonClick {
    CustomFontViewController *custom = [CustomFontViewController new];
    custom.fontName = @"YouYuan";
    [self.navigationController pushViewController:custom animated:YES];
}

- (void)fontListViewButtonClick {
    FontListViewController *font = [FontListViewController new];
    [self.navigationController pushViewController:font animated:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
